package de.koller.million.render.util;

import de.koller.million.render.RenderRoot;
import de.koller.oceanFramework.gl.util.ParticleTexture;
import de.koller.oceanFramework.tree.Mother;
import de.koller.oceanFramework.tree.Sea3X;
import org.lwjgl.input.Keyboard;

public class GUI extends Sea3X {

	@Mother private RenderRoot rroot;
	private ParticleTexture texture;
//	private FrameTexture frameTexture;
	
	@Override
	protected void init() {
		super.init();
		
		texture = ParticleTexture.generate( 800, 600 );
		texture.clear( 0xff00ff00 );
		texture.flush();
		
//		frameTexture = FrameTexture.generate( 200, 150 );
	}

	@Override
	protected void update( int elapsedTime ) {
		super.update( elapsedTime );
		
		if( rroot.input.isKeyPressed( Keyboard.KEY_C ) ) {
			System.out.println( "Kamerapos: " + rroot.camera.getPosition() );
			System.out.println( "KameraRotX: " + rroot.camera.getRotX() );
			System.out.println( "KameraRotY: " + rroot.camera.getRotY() );
		}
	}
	
	@Override
	protected void render( int elapsedTime ) {
		super.render( elapsedTime );
		
//		ViewUtil.readDepth( texture );

//		System.out.println( ViewUtil.worldPosition( 0, 400, texture.floatAt( 0, 0 ) ) );
		
//		frameTexture.bindFBO();
//			rroot.camera.preTransform();
//			rroot.floor.rendering( 0 );
//			rroot.camera.postTransform();
//		frameTexture.unbindFBO();	
//		
//		ViewUtil.initOrtho();
//		ViewUtil.draw2D( frameTexture.getTexture(), 0, 0, 200, 150, 0, 0, 0, 1, 1 );
	}
	
}
